A good answer might be:

String.charAt(int index)

...evaluates to the character that is at location index in the String.

The beginning character in a String is at location 0.


String Reverser

This program reverses the characters in a String. It does this by copying characters one at a time from right to left from the input String to the end of a reversed String.

public class ReverseTester
{

  public static String reverse( String data )
  {
    String rev = new String();

    for ( int j=data.length()-1; j >= 0; j-- )
      rev += data.charAt(j);

    return rev;
  }

  public static void main ( String[] args )
  {
    System.out.println( reverse( "Hello" ) );
  }
}

Here is a sample run of this program:

C:\>java  ReverseTester 
olleH

QUESTION 3:

(Tricky Thought Question: ) How many objects does reverse() construct in this example?